# -*- coding: utf-8 -*-
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import redirect, render_to_response
from django.template import RequestContext

from forms import FeedbackForm

def form(request): 
    form = FeedbackForm(request.POST or None)
    if form.is_valid():
        form.save()
        if request.is_ajax():
            return HttpResponse('SUCCESS')
        return redirect('feedback:feedback_form_done')
    return render_to_response('feedback/feedback_form.html',
                              {'feedback_form': form},
                              context_instance=RequestContext(request))


#EOF




